package com.wyl.auth.controller;

import com.wyl.auth.dto.SysDictTypeDto;
import com.wyl.auth.req.SysDictTypeReq;
import com.wyl.auth.service.SysDictTypeService;
import com.wyl.auth.vo.SysDictTypeVo;
import com.wyl.common.CommonPage;
import com.wyl.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* @Description 字典类型表
* @Author WuYiLong
* @Date 2025-04-27
*/
@Api(tags = "字典类型")
@RestController
@RequestMapping("sysDictType")
public class SysDictTypeController {

    @Autowired
    private SysDictTypeService sysDictTypeService;

    @ApiOperation(value = "保存")
    @PostMapping(value = "save")
    public ResponseData save(@RequestBody SysDictTypeDto dto) {
        sysDictTypeService.save(dto);
        return ResponseData.getSuccess();
    }

    @ApiOperation(value = "分页")
    @PostMapping(value = "page")
    public ResponseData<CommonPage<SysDictTypeVo>> page(@RequestBody SysDictTypeReq req) {
        return ResponseData.getSuccessInstance(sysDictTypeService.page(req));
    }

    @ApiOperation(value = "删除")
    @PostMapping(value = "deleteByIds")
    public ResponseData deleteByIds(@RequestBody List<Long> ids) {
        sysDictTypeService.deleteByIds(ids);
        return ResponseData.getSuccess();
    }
}
